space that extend past byte 0xff.
Signed-off-by: Keir Fraser <keir@xensource.com>
uint32_t address, int len)
{
uint32_t val;
-
switch(len) {
- default:
- case 4:
- if (address <= 0xfc) {
- val = le32_to_cpu(*(uint32_t *)(d->config + address));
- break;
- }
- /* fall through */
- case 2:
- if (address <= 0xfe) {
- val = le16_to_cpu(*(uint16_t *)(d->config + address));
- break;
- }
- /* fall through */
case 1:
val = d->config[address];
break;
+ case 2:
+ val = le16_to_cpu(*(uint16_t *)(d->config + address));
+ break;
+ default:
+ case 4:
+ val = le32_to_cpu(*(uint32_t *)(d->config + address));
+ break;
}
return val;
}
d->config[addr] = val;
}
- if (++addr > 0xff)
- break;
+ addr++;
val >>= 8;
}
#define PCI_MAX_LAT 0x3f /* 8 bits */
struct PCIDevice {
- /* PCI config space */
- uint8_t config[256];
+ /*
+ * PCI config space. The 4 extra bytes are a safety buffer for guest
+ * word/dword writes that can extend past byte 0xff.
+ */
+ uint8_t config[256+4];
/* the following fields are read only */
PCIBus *bus;